package packets.server;

import java.io.Serializable;

/**
 * a Class containing users , and maps user ID into user name
 * used to send a list of users and IDs to a client in a packet 
 */
public class UserList implements Serializable{

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private String[] _users;
	private Integer[] _ids;

	/**
	 * Creates an instance of {@link UserList}
	 * will map the i element in ids to the i element in users
	 * @param users the array of the user IDs
	 * @param ids the array of the user names
	 */
	public UserList(String[] users, Integer[] ids) {
		this._users = users;
		this._ids = ids;
	}
	/**
	 * gets a user name by his id
	 * @param id user ID
	 * @return the user name of that ID
	 */
	public String getUsers(int id) {
		return _users[id];
	}
	/**
	 * 
	 * @return an array with all the user IDs that this instance contains
	 */
	public Integer[] getIds() {
		return _ids;
	}
	/**
	 * 
	 * @return the size of the uesr list which this instance represents
	 */
	public int getLength(){
		return _users.length;
	}



}
